package com.rr.postprocess;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.stereotype.Component;

/**
 * @author zhuangcanrun
 * @Date 2022/02/08/23:32
 * @description
 **/

/*
* 可自定义BeanFactPostProcessor，给beanDefinition做一些额外动作，从而影响后续实例化、初始化生成的bean对象
* */
@Component
public class MyBeanFactoryPostProcessor implements BeanFactoryPostProcessor {
    @Override
    public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
        BeanDefinition asyncServiceImpl = beanFactory.getBeanDefinition("asyncServiceImpl");
        System.out.println(asyncServiceImpl);
    }
}
